package com.example.service.impl;

import com.example.mapper.measuringToolChecklistMapp;
import com.example.pojo.measuringToolChecklistPojo;
import com.example.service.measuringToolChecklistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service
public class measuringToolChecklistImpl implements measuringToolChecklistService {
    @Autowired
    private measuringToolChecklistMapp measuringToolChecklistMapp;
   public List<measuringToolChecklistPojo> queryOneField(Map<String,Object> map){
       String fieldName = (String) map.get("fieldName");
       String maxValStr= (String) map.get("maxVal");
       String minValStr= (String) map.get("minVal");
       DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
       LocalDateTime maxVal = LocalDateTime.parse(maxValStr, formatter);
       LocalDateTime minVal = LocalDateTime.parse(minValStr, formatter);
       List<measuringToolChecklistPojo> list = measuringToolChecklistMapp.queryOneField(fieldName,minVal,maxVal);
       return list;
   }
}
